from appium.webdriver.common.appiumby import AppiumBy as By
from pages.base_page import BasePage


# 定位器
cpllect_locator = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("收藏")')
course_locator=(By.XPATH,'//android.widget.TextView[@text="课程"]')
collect_course_find_hot_recipe_btn_locator=(By.XPATH,'//android.widget.TextView[@resource-id="com.xiachufang:id/collect_course_find_hot_recipe_btn"]')
instance_locator=(By.ANDROID_UIAUTOMATOR,'new UiSelector().className("android.view.View").instance(28)')


class CpllectCoursePage(BasePage):

    def click_cpllect(self):
        """
        点击收藏
        :return:
        """
        self.find_element(cpllect_locator).click()

    def click_course(self):
        """
        点击课程
        :return:
        """
        self.find_element(course_locator).click()

    def click_collect_course_find_hot_recipe_btn(self):
        """
        点击发现热门课程
        :return:
        """
        self.find_element(collect_course_find_hot_recipe_btn_locator).click()
    def click_instance(self):
        """
        点击第一个课程
        :return:
        """
        self.find_element(instance_locator).click()


